package com.uzai.console.service.feign.impl;

import com.uzai.common.msg.MsgDto;
import com.uzai.common.result.ResponseCode;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.dto.feign.config.ClearDeviceCacheDto;
import com.uzai.console.dto.feign.titok.TiktokGetConversDto;
import com.uzai.console.dto.rocketmq.androidapp.AndroidSetConfigDto;
import com.uzai.console.dto.rocketmq.androidapp.UpdateAndroidAppDto;
import com.uzai.console.dto.rocketmq.pyqfollow.FollowConfigDto;
import com.uzai.console.dto.rocketmq.wxgroup.*;
import com.uzai.console.service.feign.UzaiImClientFeignService;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Auther: liuqi
 * @Date: 2021/11/24 16:24
 * @Description:
 */
@Component
public class UzaiImClientFeignFallbackFactory implements FallbackFactory<UzaiImClientFeignService> {

    private static Logger logger = LoggerFactory.getLogger(UzaiImClientFeignFallbackFactory.class);

    @Override
    public UzaiImClientFeignService create(Throwable throwable) {

        logger.error("--调用微服务失败，err:={}", throwable);

        return new UzaiImClientFeignService() {
            @Override
            public UzaiRespVo<Boolean> pyqFollow(MsgDto<FollowConfigDto> msgDto) {
                UzaiRespVo<Boolean> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> androidAppUpdate(MsgDto<UpdateAndroidAppDto> msgDto) {
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> androidSetConfigPush(MsgDto<AndroidSetConfigDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> cleanDeviceCache(MsgDto<ClearDeviceCacheDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> reflashTiktokConversation(MsgDto<TiktokGetConversDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxAddGroupmemberTofriends(MsgDto<WorkWxAddGroupMemberToFriends> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxAddgroupWelcomemsg(MsgDto<WorkWxAddGroupWelcomeMsg> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxDismissGroup(MsgDto<WorkWxDismissGroup> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxGetAntispamrule(MsgDto<Object> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxGetGroupBlacklist(MsgDto<WorkWxGetGroupBlackList> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxGetGroupQrcode(MsgDto<WorkWxGetGroupQrCode> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxGetGroupWelcomemsgList(MsgDto<WorkWxGetGroupWelcomeMsgList> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxProhibitSetgroupname(@RequestBody MsgDto<WorkWxProhibitSetGroupName> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxSetAntispamrule(@RequestBody MsgDto<WorkWxSetAntiSpamRule> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxSetgroupInviteconfirm(@RequestBody MsgDto<WorkWxSetGroupInviteConfirm> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxSetgroupManager(@RequestBody MsgDto<WorkWxSetGroupManager> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxSetgroupMembertoblacklist(@RequestBody MsgDto<WorkWxSetGroupMemberToBlackList> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> workwxSetgroupWelcomemsg(@RequestBody MsgDto<WorkWxSetGroupWelcomeMsg> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> setGroupName(MsgDto<UpdateNicknameDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> createGroup(MsgDto<CreateWxworkGroupDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> inviteJoinGroup(MsgDto<InviteWxworkGroupDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> sendGroupNotice(MsgDto<SendGroupNoticeDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<Object> wxworkAddGroupmemberTofriends(MsgDto<AddFriendReqWxworkDto> msgDto){
                UzaiRespVo<Object> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }
        };
    }

}
